$(document).ready(function(){

        $('#paypal-payment-form').submit();

        $('#account_validation_submit').on('click', function(e){

                //e.preventDefault();
                $(".account_invalid_message").html("<p>Processing .... </p>");

                var payment_amount = $("input[name='payment_amount']").val();
                var payers_account = $("input[name='payers_account']").val();

                $.post('ajax.php', {payment_amount:payment_amount, payers_account:payers_account,}, function(data){

                        if(data === 'invalid'){
                                $(".account_invalid_message").html("<p>Given Account Number is invalid</p>");
                        }

                        else if(data === 'valid'){
                                $("#account_validation_form").submit()
                        }

                });
        });


});
